package com.sky.mapper.admin;


import com.sky.annotation.AutoFill;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Employee;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     *
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);


    /**
     * 插入员工数据
     *
     * @param employee
     * @return
     */
    @AutoFill(value = OperationType.INSERT)
    boolean insert(Employee employee);

    /**
     * 模糊查询,根据名字查询员工
     *
     * @param name
     * @return
     */

    List<Employee> selectEmpsByPage(String name);

    @Update("update employee set status = #{status} where id = #{id}")
    boolean uptateEmpStatus(@Param("status") Integer status, @Param("id") Long id);

    @Select("select * from employee where id = #{id}")
    Employee selectEmpsById(Long id);

    @AutoFill(value = OperationType.UPDATE)
    boolean update(Employee employee);
}
